/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be.vdab.schoolgerief;

import be.vdab.util.Laadbaar;
import be.vdab.util.Volume;
import java.io.Serializable;

/**
 *
 * @author Joris
 */
public class Boekentas implements Laadbaar, Serializable{
    private Volume laadvolume;
    private String kleur;
    
    public Boekentas(String kleur, Volume laadvolume){
        if (laadvolume == null | kleur==null)
            throw new IllegalArgumentException();
        else {
            this.laadvolume = laadvolume;
            this.kleur = kleur;
        }
                    
        
    }
    
    @Override
    public Volume getLaadvolume() {
        return this.laadvolume;
    }

    @Override
    public void setLaadvolume(Volume laadvolume) {
        if (laadvolume == null)
            throw new IllegalArgumentException();
        else {
            this.laadvolume = laadvolume;
        }
    }

    public String getKleur() {
        return this.kleur;
    }

    public void setKleur(String kleur) {
        if (kleur==null)
            throw new IllegalArgumentException();
        else {
            this.kleur = kleur;
        }
    }
    
    
    @Override
    public final String toString(){
        return String.format("boekentas %s %s", this.kleur, this.laadvolume.toString());
    }
    
       
    @Override
    public int hashCode(){
       return this.toString().hashCode();
    }
    
    @Override
    public boolean equals(Object o){
         if (o == null)
            return false;
         else
            if (o instanceof Boekentas){
                Boekentas b = (Boekentas) o;
                //if (getLaadvolume().getHoogte() == v.getHoogte() & getLaadvolume().getBreedte() == v.getBreedte() & getLaadvolume().getDiepte() == v.getDiepte() & getLaadvolume().getMaat() == v.getMaat())
                if (getLaadvolume().equals(b.getLaadvolume()) & getKleur().equals(b.getKleur()))
                    return true;
                else
                   return false;
            }
            else
               return false;

    }
}
